package com.xb.cloud.merchantapi.product.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xb.cloud.gateway.client.ReturnCodes;
import com.xb.cloud.gateway.client.ReturnUtils;
import com.xb.cloud.gateway.client.RtnInfo;
import com.xb.cloud.merchantapi.product.service.CategoryApiService;
import com.xb.cloud.product.merchant.service.client.CategoryService;
import com.xb.cloud.service.client.ServiceReturnInfo;
import com.xb.cloud.service.client.ServiceReturnUtils;

/**
 * 
 * @Description:商家发布商品，获取类目数据服务
 * @author: 鲜备科技
 * 
 * @Copyright: 2017 www.xianbeitech.com Inc. All rights reserved.
 *
 */
@Service
public class CategoryApiServiceImpl implements CategoryApiService {
	@Autowired
	private CategoryService categoryService;

	/**
	 * 根据公司id获取后台类目列表，[分页] 
	 */
	@Override
	public RtnInfo getCategoryBoTreeByCompanyId(long companyId ) {
		// 获取数据
		ServiceReturnInfo returnInfo = categoryService.getCategoryBoTreeByCompanyId(companyId );
		if(ServiceReturnUtils.isSuccess(returnInfo)){
			return  ReturnUtils.success(returnInfo.getData());
		}else{
			return ReturnUtils.error(ReturnCodes.SYSTEM_EXCEPTION);
		}
	}

}
